from fractions import Fraction

class BigDiv:
    def __init__(self, a, b, width):
        self.__check(a)
        self.__check(b)
        self.__a = a.strip()
        self.__b = b.strip()
        self.__width = width if width > 0 else 0
        diff1 = True if self.__a.startswith("-") else False
        diff2 = True if self.__b.startswith("-") else False
        self.diff = diff1 ^ diff2
        p1 = self.__pos(self.__a)
        p2 = self.__pos(self.__b)
        if p1 > p2:
            self.__b += "0" * (p1 - p2)
        elif p1 < p2:
            self.__a += "0" * (p2 - p1)
        self.__a = self.__a.replace(".", "")
        self.__b = self.__b.replace(".", "")
        self.__a += "0" * self.__width
        self.__div()
    def __check(self, a):
        try:
            a1 = int(a)
            a2 = float(a)
        except: raise Exception(f"{a}不是数字")
    def __pos(self, a):
        pos = a.find(".")
        if -1 == pos: return 0
        return len(a) - pos - 1
    def __div(self):
        a = self.__a
        b = self.__b
        len_a = len(a)
        len_b = len(b)
        c = ""
        tmp_a = int(a[:len_b])
        tmp_b = int(b)
        for i in range(len_a - len_b + 1):
            if 0 == tmp_a: c += "0"
            enough = False
            for j in range(9, 0, -1):
                if tmp_a >= tmp_b * j:
                    c += str(j)
                    enough = True
                    tmp_a = int(str(tmp_a - tmp_b * j) + a[len_b + i: len_b + i + 1])
                    break
            if not enough: tmp_a = int(a[i: len_b + i] + a[len_b + i: len_b + i + 1])
        if len(c) > self.__width: c = c[:len(c) - self.__width] + "." +c[len(c) - self.__width:]
        else: c = "0." + "0" * (self.__width - len(c)) + c
        self.__c = c
    def __str__(self):
        return self.__c

class Frac:
    def __init__(self, a, b, width):
        self.__frac = Fraction(a, b)
        self.__width = width
    def __add__(self, frac):
        self.__frac += frac
        return self
    def __sub__(self, frac):
        self.__frac -= frac
        return self
    def __mul__(self, frac):
        self.__frac *= frac
        return self
    def __truediv__(self, frac):
        self.__frac /= frac
        return self
    def __str__(self):
        return str(BigDiv(str(self.__frac.numerator * 100), str(self.__frac.denominator), self.__width)) + "%"

